ImageGear Professional v18 for Mac
Zooming an Image

From the Display menu choose Zoom in to zoom an image in or Zoom out to zoom an image out.

The following code fragment demonstrates a Zoom in operation:

 
Copy Code

- (IBAction)mnuDisplayZoomIn:(id)sender {
    double dblHZoom, dblVZoom;
   
    // Get previous zoom factors
    IG_dspl_zoom_get(hIGear, 0, (__bridge HWND)mainScrollViewOutlet, NULL, &dblHZoom, &dblVZoom );
    if( dblHZoom <= 10 && dblVZoom <= 10)
    {
        dblHZoom *= 1.25;
        dblVZoom *= 1.25;
        // Set new zoom factors
        IG_dspl_zoom_set( hIGear, 0, IG_DSPL_ZOOM_H_FIXED|IG_DSPL_ZOOM_V_FIXED, dblHZoom, dblVZoom );
    }
    // Update main view
    [mainScrollViewOutlet setNeedsDisplay:YES];
}

IG_dspl_zoom_get() is used to obtain current image zoom settings. In the next line, the current settings were increased by 25%, and the new zoom value was set using IG_dspl_zoom_set().

The example below is the original image zoomed in several times:

When using the Zoom command, scroll bars automatically appear on the bottom and on the right side because the image no longer fits in the window.

Scrollbars do not automatically appear until you display them with IG_dspl_scroll_set() call. See also InitScrollBars() function in the ImageGearDemo Sample.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback